package com.shanwen.shopping.fragment;

import android.view.View;

import com.classic.core.fragment.BaseFragment;
import com.shanwen.shopping.utils.EventUtil;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * 文件描述：Fragment父类
 */
public abstract class AppBaseFragment extends BaseFragment {

    private Unbinder unbinder;

    public boolean configEventBus() {
        return false;
    }


    @Override public void initView(View parentView) {
        unbinder = ButterKnife.bind(this, parentView);
    }


    @Override public void register() {
        if (configEventBus()) {
            EventUtil.registerEventBus(this);
        }
    }


    @Override public void unRegister() {
        unbinder.unbind();
        if (configEventBus()) {
            EventUtil.unRegisterEventBus(this);
        }
    }
}
